<!--
Creates a list with all users with the possibilities to edit and delete a user
-->
<h1><?php echo $title; ?></h1>
<p><?php echo anchor("admin/users/create", "Create new User"); ?></p>

<?php
if ($this->session->flashdata('message')) {
    echo "<div class='message'>" . $this->session->flashdata('message') . "</div>";
}
// checks if there are any users and create a table
if (count($user)) {
    echo "<table border='1' cellspacing='0' celpadding='3' width='700px'>\n";
    echo "<tr valign='top'>\n";
    echo "<th>ID</th>\n<th>Username</th><th>Firstname</th><th>Lastname</th><th>Email</th><th>Status</th><th>Actions</th>\n";
    echo "</tr>\n";

    // creates a table row for each user with the info listed below
    foreach ($user as $key => $list) {
        echo "<tr valign='top'>\n";
        echo "<td>" . $list['id'] . "</td>";
        echo "<td>" . $list['username'] . "</td>";
        echo "<td>" . $list['first_name'] . "</td>";
        echo "<td>" . $list['last_name'] . "</td>";
        echo "<td>" . $list['email'] . "</td>";
        echo "<td align='center'>" . $list['status']."</td>";
        echo "<td align='center'>";
        echo anchor('admin/users/edit/' . $list['id'],'edit');
        echo " | ";
        echo anchor('admin/users/delete/' . $list['id'],'delete');
        echo "</td>";
        echo "</tr>";
    }
    echo "</table>";
}
?>